package com.ai.model;

import com.ai.util.ApplicationContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author hh
 * @since 2024/6/1
 */
@Component
public class ChatRequestFactory implements CommandLineRunner {

    @Value("${big-model.name}")
    private String bigModelName;

    private ChatRequest chatRequest;

    @Autowired
    private ApplicationContextUtil applicationContextUtil;

    @Override
    public void run(String... args) throws Exception {
        switch (bigModelName) {
            case "xf":
                chatRequest = applicationContextUtil.getInstance("xfChatAiRequest", ChatRequest.class);
                break;
            case "kimi":
                chatRequest = applicationContextUtil.getInstance("kimiChatAiRequest", ChatRequest.class);
                break;
            case "tyqw":
                chatRequest = applicationContextUtil.getInstance("tyqwChatAiRequest", ChatRequest.class);
                break;
            default:
        }
    }

    public ChatRequest getChatRequest() {
        return chatRequest;
    }
}
